<?php
/**
 * Helper principal do sistema
 * Main helper of the system
 * @author henrisk
 */
class ts {

	/**
	 * Configurações
	 * Configurations
	 * @var array
	 */
	private static $arrConfiguration;
	
	/**
	 * Recupera uma configuração pela chave
	 * Returns the value of an cofiguration by the configuration key
	 * @param string $strKey
	 * @return string
	 */
	public static function config($strKey) {
		self::loadConfiguration();
		$arrKey = explode('.', $strKey);
		$strValue = self::$arrConfiguration;
		foreach($arrKey as $strSingleKey) {
			$strValue = &$strValue[$strSingleKey];
		}
		
		return $strValue;
	}
	
	/**
	 * Carrega o arquivo de configurações em memória
	 * Loads the configuration file into the memory
	 */
	private static function loadConfiguration() {
		if(!isset(self::$arrConfiguration)){
			include(realpath(dirname(__FILE__) . '/../config.php'));
			self::$arrConfiguration = $configuration;
		}
	}
}
?>